package com.smartthinking.destinomusical.parser;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;


import android.util.Log;

public abstract class BaseFeedParser {

	// names of the XML tags
	static final String LISTADO = "LISTADO";
	static final String DIRECCION = "DIRECCION";
	static final  String TELEFONO = "TELEFONO";
	static final  String PRODUCTOS = "PRODUCTOS";
	static final  String PRODUCTO = "PRODUCTO";
	static final  String MAPA = "MAPA";
	
	//tag names for category
	static final  String NOMBRE = "NOMBRE";
	static final  String ID = "ID";
	static final  String HC = "HC";
	
	//tag names for classification
	
	
	private final URL feedUrl;

	protected BaseFeedParser(String feedUrl){
		try {
			this.feedUrl = new URL(feedUrl);
		} catch (MalformedURLException e) {
			Log.e("MalformedURLException",e.getMessage());
			throw new RuntimeException(e);
		}
	}

	protected InputStream getInputStream() {
		try {
//			HttpURLConnection urlConn = (HttpURLConnection) feedUrl.openConnection();
//			InputStream is = new BufferedInputStream(feedUrl.openStream()); 
			return feedUrl.openConnection().getInputStream();
			//return is;
		} catch (IOException e) {
			Log.e("IOException",e.getMessage());
			throw new RuntimeException(e);
		}
	}
}